$OpenBSD: patch-mgpembed_pl_in,v 1.1 2013/06/23 13:22:41 espie Exp $
--- mgpembed.pl.in.orig	Tue Jan  5 04:44:00 1999
+++ mgpembed.pl.in	Sun Jun 23 15:15:34 2013
@@ -16,15 +16,16 @@ if (! -x $gzip || ! -x $uuencode) {
 	die "external program not found. manual configuration required.\n"
 }
 
-require 'getopts.pl';
+use Getopt::Std;
+use subs (qw(usage readfile));
 
 # specify suffixes we should gzip files before uuencoding
 @gzipsuffix = (".ps", ".xbm");
 
-do Getopts('o:');
+getopts('o:');
 
 if ($#ARGV != 0) {
-	do usage();
+	usage();
 	# NOTREACHED
 }
 
@@ -37,14 +38,14 @@ if (defined($opt_o)) {
 	die "$outfname already exists\n" if -f $outfname;
 	die "$outfname is specified for both input/output\n"
 		if ($outfname eq $infname);
-	open(OUT, "> $outfname") || die "Can not open $outfname: $!";
+	open(OUT, ">", $outfname) || die "Can not open $outfname: $!";
 } else {
 	open(OUT, ">& STDOUT");
 }
 
 # read the file, process %include directives
 
-do readfile($infname, 'INPUT000');
+readfile($infname, 'INPUT000');
 
 # append embedded files using %embed/%endembed directives
 
@@ -76,10 +77,10 @@ foreach $efile (keys %files) {
 close(OUT);
 
 sub readfile {
-	local($filename, $input) = @_;
-	local($fname, $fname0);
+	my($filename, $input) = @_;
+	my($fname, $fname0);
 	$input++;
-	open($input, $filename) || die "Can not open $filename: $!\n";
+	open($input, '<', $filename) || die "Can not open $filename: $!\n";
 	while (<$input>) {
 		if (/^%%/) {
 			print OUT;
@@ -116,7 +117,7 @@ sub readfile {
 				$incfname = $1;
 			}
 			print OUT "\%\%\%\%\%\%\%\%\%\%INCLUDE $incfname\n";
-			do readfile($incfname, $input);
+			readfile($incfname, $input);
 			print OUT "\%\%\%\%\%\%\%\%\%\%INCLUDE-END $incfname\n";
 		} else {
 			print OUT;
@@ -128,5 +129,5 @@ sub readfile {
 
 sub usage {
 	print STDERR "usage: mgpembed [-o outfile ] mgpfile\n";
-	exit -1;
+	exit 1;
 }
